﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyThuoc.DAL;
namespace QuanLyThuoc.BUS
{
    class ThuocBUS
    {
        private static readonly ThuocDAL thuoc = new ThuocDAL();
        public static DataTable SelectAll_Thuoc()
        {
            return thuoc.SelectAll_Thuoc();
        }
        public static DataTable SelectIDThuoc(int IdThuoc)
        {
            return thuoc.SelectIDThuoc(IdThuoc);

        }
        public static DataTable SelectIDThuocMax()
        {
            string sql = @"Select Max(IDThuoc) from tbThuoc";
            return thuoc.GetDataTable(sql);

        }
        public static DataTable LayTenThuocTheoIDs(int IdThuoc)
        {

            return thuoc.LayTenThuocTheoIDs(IdThuoc);
        }
        public static DataTable LayTenThuocTheoID()
        {
            string sql = @"Select TenThuoc,IDThuoc from tbThuoc order by TenThuoc";
            return thuoc.GetDataTable(sql);
        }
        public static DataTable SearchThuocByCondition(string keyword)
        {
            return thuoc.SearchThuocByCondition(keyword);
        }
        public static DataTable LayThuocTheoTen()
        {
            string sql = @"SELECT IDThuoc,TenThuoc,Dvt,DvtMua,HeSoQD FROM tbThuoc order by TenThuoc";
            return thuoc.GetDataTable(sql);
        }
        public static int InsertThuoc(string TenThuoc, string DVT, string DVTMua, decimal HeSoQD, string LoaiThuoc, string NhomThuoc, string DuongDung, string CongDung, string ChongChiDinh, string DieuKienBaoQuan, int IdNCC, int ThoiHanSuDung, int SoLuongMin)
        {
            return thuoc.InsertThuoc(TenThuoc, DVT, DVTMua, HeSoQD, LoaiThuoc, NhomThuoc, DuongDung, CongDung, ChongChiDinh, DieuKienBaoQuan, IdNCC, ThoiHanSuDung, SoLuongMin);
        }
        public static int UpdateThuoc(int IdThuoc, string TenThuoc, string DVT, string DVTMua, decimal HeSoQD, string LoaiThuoc, string NhomThuoc, string DuongDung, string CongDung, string ChongChiDinh, string DieuKienBaoQuan, int IdNCC, int ThoiHanSuDung, int SoLuongMin)
        {
            return thuoc.UpdateThuoc(IdThuoc,TenThuoc, DVT, DVTMua, HeSoQD, LoaiThuoc, NhomThuoc, DuongDung, CongDung, ChongChiDinh, DieuKienBaoQuan, IdNCC, ThoiHanSuDung, SoLuongMin);

        }
        public static int DeleteThuoc(int IdThuoc)
        {
            return thuoc.DeleteThuoc(IdThuoc);
        }
    }
}
